package org.feuyeux.pattern.behavioral.interpreter;

public class And extends Expression {

  private final Expression left;
  private final Expression right;

  public And(Expression left, Expression right) {
    this.left = left;
    this.right = right;
  }

  @Override
  public boolean interpret(Context ctx) {
    return left.interpret(ctx) && right.interpret(ctx);
  }

  @Override
  public String toString() {
    return "(" + left.toString() + " AND " + right.toString() + ")";
  }
}